/*
 * @User 		@Company 	@Date
 * marcusbui	VNNET24  	Jun 19, 2011
 */
package tsb.com.html5.controller.common;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import tsb.com.html5.controller.base.BaseController;

// TODO: Auto-generated Javadoc
/**
 * The Class PageController.
 */
@Controller
@RequestMapping("/page/**")
public class PageController extends BaseController{

	/**
	 * Handle.
	 *
	 * @param request the request
	 * @param response the response
	 * @return the model and view
	 * @throws Exception the exception
	 */
	@RequestMapping(method = RequestMethod.GET)
	protected ModelAndView handle(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		String pageId = request.getParameter("id");
		ModelAndView model = null;
		try {
			if(pageId!=null){
				model = new ModelAndView(pageId);
			}else{
				model = new ModelAndView("home");
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		return model;
	}
}
